class Solution(object):
    def lengthOfLongestSubstring(self, s):
        """
        :type s: str
        :rtype: int
        """
        if not s :
            return 0
        a=[]
        max_num=0
        for x in s:
            while x in a:
                del a[0]
            a.append(x)
            if len(a)>max_num:
                max_num=len(a)
        return max_num